﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Administrator/MasterPage.master"
    AutoEventWireup="true" CodeFile="ReportRevenue.aspx.cs" Inherits="Administrator_ReportRevenue" %>

<%@ Register Assembly="CollectionPager" Namespace="SiteUtils" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div id="content">
        <script type="text/javascript">
            var index = "";
            $(document).ready(function () {
                $("input.add").click(function () {
                    window.location.open(window.location + "ReportAdd.aspx");
                });
                $("input.del").click(function () {
                    $("table input[type=checkbox].item").each(function () {
                        var checked = $(this).attr("checked");
                        if (checked) {
                            index = index + $(this).attr("value") + ";";
                        }
                    });
                    $("#<%=hdfCheck.ClientID%>").val(index);
                    if (index == "") return false;
                    else return confirm("Xác nhận xóa !");
                });
                $("input[title=Display]").click(function () {
                    var input = $(this);
                    $.ajax({
                        type: "POST",
                        url: "../service/hentocdo.asmx/DisplayPublish",
                        data: "{'PUBLISHER_ID':'" + $(this).parent().parent().attr("id") + "'}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        beforeSend: function () {
                            $("div.message").html("");
                        },
                        success: function (message) {
                            if (message.d == false) {
                                $("div.message").html("<div id='message-error' class='message message-error'><div class='image'><img src='../resources/images/icons/error.png' alt='Error' height='32' /></div><div class='text'><h6>Lỗi</h6><span>Chưa thực hiện được!</span></div><div class='dismiss'><a href='#message-error'></a></div></div>");
                            }
                            else {
                                if ($(input).hasClass("True")) {
                                    $(input).removeClass("True");
                                    $(input).addClass("False");
                                }
                                else {
                                    $(input).removeClass("False");
                                    $(input).addClass("True");
                                }
                                $("div.message").html("<div id='message-success' class='message message-success'><div class='image'><img src='../resources/images/icons/success.png' alt='Success' height='32' /></div><div class='text'><h6>Thông Báo</h6><span>Cập nhật thành công !</span></div><div class='dismiss'><a href='#message-success'></a></div></div>");
                            }
                        },
                        error: function (errormessage) {
                            $("div.message").html("<div id='message-error' class='message message-error'><div class='image'><img src='../resources/images/icons/error.png' alt='Error' height='32' /></div><div class='text'><h6>Lỗi</h6><span>Chưa thực hiện được!</span></div><div class='dismiss'><a href='#message-error'></a></div></div>");
                        }
                    });
                });

                // fomat datetime here
                $.datepicker.regional['vi'] = {
                    dateFormat: 'dd/mm/yy'
                };
                $.datepicker.setDefaults($.datepicker.regional['vi']);
            });
        </script>
        <asp:HiddenField ID="hdfCheck" runat="server" />
        <div class="box">
            <!-- box / title -->
            <div class="title" style="background-color: #3B5998">
                <h5 id="txtTitle">
                    Doanh thu tổng hợp bán sản phẩm
                </h5>
            </div>
            <div id="divMessage" runat="server">
                <div style="margin-left: 20px; font-size: small;">
                    <b>Thống Kê Từ &nbsp;&nbsp;
                        <asp:TextBox ID="txtdate" CssClass="date" runat="server"></asp:TextBox></b>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <b>Đến &nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:TextBox ID="txtdate1" CssClass="date" runat="server"></asp:TextBox></b>
                    &nbsp;&nbsp;<br />
                    <br />
                    <br />
                    &nbsp;&nbsp;&nbsp; <b>Loại thẻ</b> &nbsp;&nbsp;&nbsp;
                    <asp:DropDownList ID="ddlloaithe" runat="server" Width="150px">
                    </asp:DropDownList>
                    &nbsp; <b>Nhóm sản phẩm</b>&nbsp;&nbsp;&nbsp;
                    <asp:DropDownList ID="ddlnhomsp" runat="server" Width="150px">
                    </asp:DropDownList>
                    <b>Nhân viên BH</b>&nbsp;&nbsp;&nbsp;
                    <asp:DropDownList ID="ddlnv" runat="server" Width="150px">
                    </asp:DropDownList>
                    &nbsp;&nbsp;
                    <br />
                    <br />
                    <span style="margin-left: 103px;">
                        <asp:Button ID="btnthongke" runat="server" Text="Thống Kê" OnClick="btnthongke_Click"
                            Height="35px" Width="150px" />
                    </span>
                    <%--<asp:ImageButton ID="imgbtn" runat="server" ImageUrl="~/AdminIcon/chart-icon.png" OnClick="btnthongke_Click"  />--%>
                </div>
            </div>
            <div style="margin-left: 500px;">
            </div>
            <br />
            <div class="first-action">
                <div class="button">
                    <%--   <asp:Button aria-disabled="false" role="button" CssClass="add ui-button ui-widget ui-state-default ui-corner-all"
                        Text="Cập nhật thứ tự hiển thị" runat="server" ID="btnUpdateDisplayOrder" OnClick="btnUpdateDisplayOrder_Click" />
                    <br>--%>
                </div>
            </div>
            <!-- end box / title -->
            <br />
            <br />
            <br />
            <center>
                <h2>
                    Doanh thu theo nhóm sản phẩm <span style="color=red;">
                        <asp:Label ID="Label1" runat="server"></asp:Label></span>
                </h2>
            </center>
            <br />
            <br />
            <div class="table">
                <table style="width: 100%;">
                    <thead>
                        <tr>
                            <th class="stt">
                                STT
                            </th>
                            <th>
                                Nhóm thẻ (SP)
                            </th>
                            <th>
                                Số Lượng
                            </th>
                            <th>
                                thành tiền (VNĐ)
                            </th>
                            <th>
                                Tồn kho
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater runat="server" ID="rptthongke">
                            <ItemTemplate>
                                <tr>
                                    <td align="center">
                                        <%#Container.ItemIndex+1 %>
                                    </td>
                                    <td valign="middle" align="center">
                                        <b><a href="">
                                            <%#Eval("nhomthe")%></a></b>
                                    </td>
                                    <td valign="middle" align="center">
                                        <%#Eval("Sl")%>
                                    </td>
                                    <td valign="middle" align="center">
                                        <%#Eval("tien")%>
                                    </td>
                                    <td valign="middle" align="center">
                                        <%#Eval("tonkho")%>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                        <tr>
                            <td align="center">
                            </td>
                            <td valign="middle" align="center">
                                <b>Tổng </b>
                            </td>
                            <td valign="middle" align="center">
                                #
                            </td>
                            <td valign="middle" align="center">
                                <span style="color: Red;"><b>
                                    <asp:Label ID="lbltotalmoney" runat="server" Text="0"></asp:Label></b></span>
                            </td>
                            <td valign="middle" align="center">
                                #
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <br />
                <div class="action">
                </div>
            </div>
            <br />
            <br />
            <br />
            <center>
                <h2>
                    Doanh thu chi tiết</h2>
            </center>
            <br />
            <br />
            <div class="table">
                <table style="width: 100%;">
                    <thead>
                        <tr>
                            <th class="stt">
                                STT
                            </th>
                            <th>
                                Ngày
                            </th>
                            <th>
                                Mã số thẻ (MSP)
                            </th>
                            <th>
                                Loại thẻ (SP)
                            </th>
                            <th>
                                Số Lượng
                            </th>
                            <th>
                                Số tiền (VNĐ)
                            </th>
                            <th>
                                Nhân viên bán hàng
                            </th>
                            <%-- <th>
                              Tổng Số Thẻ
                            </th>--%>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater runat="server" ID="rptData">
                            <ItemTemplate>
                                <tr>
                                    <td align="center">
                                        <%#Container.ItemIndex+1 %>
                                    </td>
                                    <td valign="middle" align="center">
                                        <b><a href="">
                                            <%#Eval("date")%></a></b>
                                    </td>
                                    <td valign="middle" align="center">
                                        <%#Eval("mathesp")%>
                                    </td>
                                    <td valign="middle" align="center">
                                        <%#Eval("loaithesp")%>
                                    </td>
                                    <td valign="middle" align="center">
                                        <%#Eval("sl")%>
                                    </td>
                                    <td valign="middle" align="center">
                                        <%#Eval("tien")%>
                                    </td>
                                    <td valign="middle" align="center">
                                        <%#Eval("nvbanhang")%>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
                <br />
                <br />
                <div style="float: right;">
                    <cc1:CollectionPager ID="CollectionPager1" runat="server" ResultsLocation="None"
                        ShowFirstLast="True" MaxPages="100" SliderSize="10" BackText="« Quay lại" 
                        FirstText="----------Đầu" LabelText="Trang :" LastText="Cuối" NextText="Tiến »">
                    </cc1:CollectionPager>
                </div>
                <div class="action">
                </div>
            </div>
        </div>
        <!-- end table -->
    </div>
</asp:Content>
